package com.newegg.app.qec.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.newegg.app.qec.R;
import com.newegg.app.qec.util.BaseActivity;
import com.newegg.app.qec.util.Constants;

/**
 * Created by Allen on 2017/12/13.
 */
public class AccountActivity extends BaseActivity implements View.OnClickListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_account);
        ImageView back = (ImageView) findViewById(R.id.img_back);
        TextView name = (TextView) findViewById(R.id.title_name);
        TextView revisepassword_tv = (TextView) findViewById(R.id.revisepassword_tv);
        name.setText("账号与安全");
        back.setOnClickListener(this);
        revisepassword_tv.setOnClickListener(this);

        if (Constants.getLoginByName(AccountActivity.this, "LoginState")) {
            revisepassword_tv.setVisibility(View.VISIBLE);
        } else {
            revisepassword_tv.setVisibility(View.GONE);
            revisepassword_tv.setClickable(false);
        }
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.img_back:
                finish();
                break;
            case R.id.revisepassword_tv:
                intent.setClass(AccountActivity.this, RevisePassWordActivity.class);
                startActivity(intent);
                break;
        }
    }
}
